﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GetAddressEdit.aspx.cs" Inherits="CNVP.JShop.Web.Member.GetAddressEdit" %>
<%@ Register src="Footer.ascx" tagname="Footer" tagprefix="uc1" %>
<%@ Register src="Header.ascx" tagname="Header" tagprefix="uc1" %>
<%@ Register src="LeftNav.ascx" tagname="LeftNav" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head2" runat="server">
    <title>发货地址</title>
    <link href="css/Global.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/Fonts.css" rel="stylesheet" type="text/css" media="all"  />
<link href="css/Style.css" rel="stylesheet" type="text/css" media="all" />
<link href="../CSS/MemberCenter.css" rel="stylesheet" type="text/css" media="all" />
    <script src="../Scripts/jquery.js" type="text/javascript"></script>
<script type="text/javascript" src="js/procp.js"></script>
<script src="../Scripts/Common.js" type="text/javascript"></script>
</head>
<body onload="ProvinceChange()">
    <form id="form1" runat="server">
<uc1:Header ID="Header1" runat="server" />
<div class="Width MBody clearfix">
<uc1:LeftNav ID="LeftNav1" runat="server" />

<div class="MRight">
                <div class="MRightTitle"><p>发货地址<asp:Label ID="lbTitle" runat="server"></asp:Label></p></div>
                <div class="MRightBox">
					<!-- Box Contents -->
                    <table border="0" cellpadding="0" cellspacing="0" class="ListTable">
                <tr>
                    <td>
                        姓名：</td>
                    <td >
                        <asp:TextBox ID="txtTrueName" runat="server" MaxLength="50"></asp:TextBox>
                    </td>
                    <td>
                        &nbsp;</td>
                    <td >
                        
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        省区：</td>
                    <td>
                        <asp:DropDownList ID="ddlProvince" runat="server">
                        <asp:ListItem Value="0">--请选择--</asp:ListItem>
                        </asp:DropDownList>
                        <span id="selectCity"></span>
                        <span id="selectArea"></span>
                         
                        </td>
                    <td>
                        邮编：</td>
                    <td>
                        <asp:TextBox ID="txtZipCode" runat="server" MaxLength="50"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        地址：</td>
                    <td colspan="3">
                        <asp:TextBox ID="txtGetAddress" runat="server" Width="558px" MaxLength="100"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        手机：</td>
                    <td>
                        <asp:TextBox ID="txtMobilePhone" runat="server" MaxLength="50"></asp:TextBox>
                    </td>
                    <td>
                        电话：</td>
                    <td>
                        <asp:TextBox ID="txtPhone" runat="server" MaxLength="50"></asp:TextBox>
                    </td>
                </tr>
                 <tr>
                    <td>
                        设置为默认地址：</td>
                    <td colspan="3">
                       
                        <asp:CheckBox ID="cbIsTolerant" CssClass="NoneBg" runat="server" />
                       
                    </td>
                </tr>
            </table>
                
                 <table align="center" class="table-action">
                    <tr>
                        <td>
                            <asp:Button ID="btSaveAddress" runat="server" onclick="btSaveAddress_Click" 
                                Text="提交" />
                        </td>
                    </tr>
                </table>
				

                </div>
</div>
</div>
    <uc1:Footer ID="Footer1" runat="server" />
    </form>
<script type="text/javascript">
    jQuery(document).ready(CheckUserLogin); 
            function ProvinceChange() {
            var ddlProvince = document.getElementById("<%=ddlProvince.ClientID %>");
            var selectCity = document.getElementById("selectCity");
            selectCity.innerHTML = GetAjaxResponse("../Admin/CommonWindows/AjaxCity.aspx?Type=ProvinceID&Code=" + ddlProvince.value);
            if(<%=id %> > 0)
            {
                if(ddlProvince.value==<%=Province %>)
                {
                    var ListCity = document.getElementById("ListCity");
                    ListCity.value=<%=City %>;
                }
            }
            CityChange();
            
        }
        //选择市时引发的动作
        function CityChange() {
            var ListCity = document.getElementById("ListCity");
            var selectArea = document.getElementById("selectArea");
            selectArea.innerHTML = GetAjaxResponse("../Admin/CommonWindows/AjaxCity.aspx?Type=CityID&Code=" + ListCity.value);
            if(<%=id %> > 0)
            {
                if(ListCity.value==<%=City %>)
                {
                    var ListArea = document.getElementById("ListArea");
                    ListArea.value=<%=Area %>;
                }
            }
        }
        $(function(){
            $("#btSaveAddress").click(function(){
                var $txtTrueName = $("#txtTrueName");
                if ($txtTrueName.val() == "") {
                    alert("请输入收货人姓名！");
                    $txtTrueName.focus();
                    return false;
                }
                var $ddlProvince=$("#ddlProvince");
                if($ddlProvince.val()=="")
                {
                    alert("请选择省区！");
                    $ddlProvince.focus();
                    return false;
                }
                var $ListCity=$("#ListCity");
                if($ListCity.val()=="")
                {
                    alert("请选择市区！");
                    $ListCity.focus();
                    return false;
                }
                var $ListArea=$("#ListArea");
                if($ListArea.val()=="")
                {
                    alert("请选择地区！");
                    $ListArea.focus();
                    return false;
                }
                var $txtGetAddress = $("#txtGetAddress");
                if ($txtGetAddress.val() == "") {
                    alert("请输入收货地址！");
                    $txtGetAddress.focus();
                    return false;
                }
                var $txtZipCode = $("#txtZipCode");
                if($txtZipCode.val()!="")
                {
                    if(!IsPostId($txtZipCode.val()))
                    {
                        alert("邮编格式不正确！");
                        $txtZipCode.focus();
                        return false;
                    }
                }
                var $txtMobilePhone = $("#txtMobilePhone");
                if ($txtMobilePhone.val() == "") {
                    alert("请输入手机号码！");
                    $txtMobilePhone.focus();
                    return false;
                }
                if(!IsValidMobilePhone($txtMobilePhone.val()))
                {
                    alert("手机号码格式不正确！");
                    $txtMobilePhone.focus();
                    return false;
                }
                var $txtPhone = $("#txtPhone");
                if($txtPhone.val()!="")
                {
                    if(!IsValidPhone($txtPhone.val()))
                    {
                        alert("电话号码格式不正确！");
                        $txtPhone.focus();
                        return false;
                    }
                }
                return true;
            });
        })
</script>
</body>
</html>

